#include "../source/server.hpp"

int main()
{
    // 创建客户端连接
    Socket clientsock;
    clientsock.CreateClient(8080, "127.0.0.1");
    for (int i = 0; i < 5; i++)
    {
        // 向服务器发送数据
        std::string str = "hello server";
        clientsock.Send(str.c_str(), str.size());

        // 接收服务器响应
        char buffer[1024];
        ssize_t n = clientsock.Recv(buffer, sizeof(buffer) - 1);
        buffer[n] = 0;
        LogMessage(NORMAL,"[echo]# %s", buffer);

        sleep(1);
    }
    while (true)
        sleep(1);
    clientsock.Close();
    return 0;
}